<template>
    <div class="row">
        <el-checkbox v-model="comp.enabled">{{ comp.__classname__ }}</el-checkbox>
        <el-button round size="small" :icon="Document" @click="gm.toConsole(comp)"></el-button>
    </div>

    <div class="row-start">
        <el-text class="span-title" truncated>Inertia</el-text>
        <el-checkbox v-model="comp.inertia" />
    </div>

    <div class="row-start">
        <el-text class="span-title" truncated>Brake</el-text>
        <el-input-number size="small" :controls="false" :step="0.1" :min=0 :max=1 v-model="comp.brake" />
    </div>

    <div class="row-start">
        <el-text class="span-title" truncated>Elastic</el-text>
        <el-checkbox v-model="comp.elastic" />
    </div>

    <div class="row-start">
        <el-text class="span-title" truncated>BounceDuration</el-text>
        <el-input-number size="small" :controls="false" :step="0.1" :min=0 :max=10 v-model="comp.bounceDuration" />
    </div>

    <div class="row-start">
        <el-text class="span-title" truncated>Content</el-text>
        <el-input size="small" disabled :value="gm.targetName(comp.content)" />
    </div>

    <div class="row-start">
        <el-text class="span-title" truncated>SizeMode</el-text>
        <el-select v-model="comp.sizeMode" size="small">
            <el-option v-for="item in sizeMode.__enums__" :key="item.value" :label="item.name" :value="item.value" />
        </el-select>
    </div>

    <div class="row-start">
        <el-text class="span-title" truncated>Direction</el-text>
        <el-select v-model="comp.direction" size="small">
            <el-option v-for="item in direction.__enums__" :key="item.value" :label="item.name" :value="item.value" />
        </el-select>
    </div>

    <div class="row-start">
        <el-text class="span-title" truncated>ScrollThreshold</el-text>
        <el-slider size="small" show-input :show-input-controls="false" :show-tooltip="false" :step="0.1" :min=0 :max=1 v-model="comp.scrollThreshold" />
    </div>

    <div class="row-start">
        <el-text class="span-title" truncated>PageTurningEventTiming</el-text>
        <el-slider size="small" show-input :show-input-controls="false" :show-tooltip="false" :step="0.1" :min=0 :max=1 v-model="comp.pageTurningEventTiming" />
    </div>

    <div class="row-start">
        <el-text class="span-title" truncated>Indicator</el-text>
        <el-input size="small" disabled :value="gm.targetName(comp.indicator)" />
    </div>

    <div class="row-start">
        <el-text class="span-title" truncated>AutoPageTurningThreshold</el-text>
        <el-input-number size="small" :controls="false" :step="0.1" v-model="comp.autoPageTurningThreshold" />
    </div>

    <div class="row-start">
        <el-text class="span-title" truncated>PageTurningSpeed</el-text>
        <el-input-number size="small" :controls="false" :step="0.1" v-model="comp.pageTurningSpeed" />
    </div>

    <div class="row-start">
        <el-text class="span-title" truncated>PageEvents</el-text>
    </div>
    <div class="span-left-20" v-for="data in gm.toEvents(comp.pageEvents)">
        <el-breadcrumb :separator-icon="ArrowRight">
            <el-breadcrumb-item>{{ data.target }}</el-breadcrumb-item>
            <el-breadcrumb-item>{{ data.component }}</el-breadcrumb-item>
            <el-breadcrumb-item>{{ data.handler }}</el-breadcrumb-item>
            <el-breadcrumb-item>{{ data.customEventData }}</el-breadcrumb-item>
        </el-breadcrumb>
    </div>
</template>

<script lang="ts" setup>
import { Document, ArrowRight } from '@element-plus/icons-vue'
import gm from './gm';

defineProps<{
    comp: CCComponent,
    update: Number,
}>()
const sizeMode = cc.PageView.SizeMode
const direction = cc.PageView.Direction
</script>